home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / minix / update~4.z / update~4 / lib_stdio_atexit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  696 b   |  32 lines

  1. /*                a t e x i t
  2.  *
  3.  * Lodge an exit handler. The handler is lodged within a list of exit
  4.  * handlers to be called by exit prior to calling _exit. The list
  5.  * is of finite length. exit will call the exits handlers in fifo
  6.  * order. The routine returns zero on failure (list overflow) and
  7.  * non-zero on success.
  8.  *
  9.  * Patchlevel 1.1
  10.  *
  11.  * Edit History:
  12.  * 06-Sep-1989    Added lint control.
  13.  * 05-Sep-1989    Created.
  14.  */
  15.  
  16. #include "stdiolib.h"
  17.  
  18. /*LINTLIBRARY*/
  19.  
  20. extern void (**_exit_hp)();        /* exit handler pointer */
  21.  
  22. int atexit(fp)
  23.  
  24. #ifdef __STDC__
  25. void (*fp)(void);                /* exit handler */
  26. #else
  27. void (*fp)();                    /* exit handler */
  28. #endif
  29. {
  30.   return (*_exit_hp != 0) ? 0 : (*_exit_hp-- = fp, 1);
  31. }
  32.